<%@ page language="java" import="com.imaker.domain.*,java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title></title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="js/plugin/frame/css/common.css">
	<link rel="stylesheet" type="text/css" href="css/system/icon.css">
	<link rel="stylesheet" type="text/css" href="js/plugin/frame/css/gridPanel.css">
	<link rel="stylesheet" type="text/css" href="js/plugin/frame/css/toolBar.css">
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/plugin/frame/GridPanel.js"></script>
	<script type="text/javascript" src="js/plugin/frame/toolBar.js"></script>
	<script type="text/javascript" src="js/page/roleOperate.js"></script>
	<script type="text/javascript" src="js/validate.js"></script>
	</style>
  </head>
  <body>
  <form action="<%=path %>/system/actionOperate/listChildren.action" id="form" name="form">
  <input type="hidden" name="flag" id="flag"/>
  <s:hidden  name="roleId"></s:hidden>
  <div class="content">
  			<table id="titleTable">
  				<tr>
  					<td><span></span></td>
  					<td><span>操作名称</span></td>
  					<td><span>说明</span></td>
  					<td><span>状态</span></td>
  				</tr>
  				</table>
  				<div class="dataContent">
  				<table id="dataTable">
  					<s:iterator id="actionOperate" value="page.list"  status="i">
	  					<tr>
	  						<td><span><input type="checkbox" name="idList" value="<s:property value="#actionOperate.id"/>"/></span></td>
	  						<td><span><s:property value="#actionOperate.name"/> </span></td>
	  						<td><span><s:property value="#actionOperate.webId"/></span></td>
	  						<td align="center"><img id='open_<s:property value="#actionOperate.id"/>' src="<%=path %>/images/system/icon/T.png" class="operateOpen"/><img id='close_<s:property value="#actionOperate.id"/>' src="<%=path %>/images/system/icon/F.png" class="operateClose"/> </td>
	  					</tr>
  					</s:iterator>
  				</table>
  				</div>
  				</div>
  				<s:hidden name="actionId" id="actionId"></s:hidden>
  				</form>
	  	<script type="text/javascript">
	  	var path = '<%=path%>';
		$(document).ready(function(){
		new GridPanel({
		titleTable : 'titleTable',
		dataTable : 'dataTable',
		width:[30,200,150,],
		collapse:true,
		toolBar : true
		});
		//添加toolBar
		var toolBar = new ToolBar({
			renderTo : 'toolBar',
			items : [{
				text : '启用',
				pic : 'ro_open',
				userable:'true',
				handler : function(){
				if(getSelectId().length==0){
				   		alert("请选择要操作的记录");
				   		return;
				   }
				$("#flag").val("T");
				roleOperateFunction.openOperate($("#form").serialize());
				for(var i=0;i<getSelectId().length;i++){
				   		var id = getSelectId()[i];
				   		changeState(id,"T");
				   }
				}		
			},'-',{
				text:'禁用',
				pic:'ro_close',
				userable:'true',
				handler:function(){
				if(getSelectId().length==0){
				   		alert("请选择要操作的记录");
				   		return;
				   }
				   $("#flag").val("F");
				   roleOperateFunction.closeOperate($("#form").serialize());
				   for(var i=0;i<getSelectId().length;i++){
				   		var id = getSelectId()[i];
				   		changeState(id,"F");
				   }
				}
			}]
				
		}).render();
		<s:iterator id="rao" value="roleActionOperateList" >
	  		changeState('<s:property value="#rao.actionOperate.id"/>',"T");
	  	</s:iterator>
		});
		
		//改变
		function changeState(id,state){
			if("F"==state){
				$("#open_"+id).hide();
				$("#close_"+id).show();
			}else if("T"==state){
				$("#close_"+id).hide();
				$("#open_"+id).show();
			}
		}
	  	</script>
  </body>
</html>
